package com.example.administrator.activity_beef;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.cbtService.AndroidSDK.BeepService;

public class beep extends AppCompatActivity {
    Button btStart,btStop,btAdd,btSub;
    int i = 100;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_beep);
        BeepService._init();
        btStart = (Button)findViewById(R.id.btStart);
        btStop = (Button)findViewById(R.id.btStop);
        btAdd = (Button)findViewById(R.id.btAdd);
        btSub = (Button)findViewById(R.id.btSub);
        btStart.setOnClickListener(this);
        btStop.setOnClickListener(this);;
        btAdd.setOnClickListener(this);;
        btSub.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btStart:{
                BeepService.PWMPlay(i);
                break;
            }
            case R.id.btStop:{
                BeepService.PWMStop();
                break;
            }
            case R.id.btAdd:{
                i=i+10;
                BeepService.PWMPlay(i);
                break;
            }
            case R.id.btSub:{
                i=i-10;
                BeepService.PWMPlay(i);
                break;
            }
        }
    }
}
    }
}
